#ifndef __MYEGLVIEW_H__
#define __MYEGLVIEW_H__

#include "CCEGLView.h"

class MyEGLView : public cocos2d::CCEGLView
{
public:
    MyEGLView();
    virtual ~MyEGLView();

    /* override functions */
    virtual bool isOpenGLReady();
    virtual void end();
    virtual void swapBuffers();
    virtual bool setContentScaleFactor(float contentScaleFactor);
    virtual void setFrameSize(float width, float height);
    virtual void setIMEKeyboardState(bool bOpen);
    virtual bool enableRetina();

	void init(HWND hWnd, HDC  hDC, HGLRC hRC);

private:
	bool Create(LPCTSTR pTitle, int w, int h);
// 	bool initGL();
// 	void destroyGL();

public:
    virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);

    // win32 platform function
    HWND getHWnd();

    // static function
    /**
    @brief    get the shared main open gl window
    */
    static MyEGLView* sharedOpenGLView();

protected:

private:
    bool m_bCaptured;
    HWND m_hWnd;
    HDC  m_hDC;
    HGLRC m_hRC;
};

#endif